<?php

require_once './vendor/autoload.php';

use Lilei\AlipayTransfer\AliPayTransferService;

class testAliPayTransferService
{
    public AliPayTransferService $pay;

    public function __construct(array $config)
    {
        $this->pay = new AliPayTransferService($config);
    }

    // 测试-单笔转账
    public function testUniTransfer(...$args)
    {
        $biz_content = [];
        $this->pay->setBizContent($biz_content);
        $callback = $this->pay->uniTransfer();
        dump($callback);
    }// testUniTransfer() end

    // 测试-转账业务单据查询接口
    public function testCommonQuery(...$args)
    {
        $biz_content = [];
        $this->pay->setBizContent($biz_content);
        $callback = $this->pay->commonQuery();
        dump($callback);
    }// testCommonQuery() end

    // 测试-支付宝资金账户资产查询
    public function testAccountQuery(...$args)
    {
        [$alipay_user_id] = $args;
        $biz_content = [
            'alipay_user_id' => $alipay_user_id,
            'account_type'   => 'ACCTRANS_ACCOUNT'
        ];
        $this->pay->setBizContent($biz_content);
        $callback = $this->pay->accountQuery();
        dump($callback);
    }// testAccountQuery() end

    // 测试-查询对账单下载地址
    public function testBillDownloadUrlQuery(...$args)
    {
        $biz_content = [];
        $this->pay->setBizContent($biz_content);
        $callback = $this->pay->billDownloadUrlQuery();
        dump($callback);
    }// testBillDownloadUrlQuery() end
}

$app_id             = "";
$app_private_key    = "";
$config = [
    'env'                   => 'dev',
    'app_id'                => $app_id,
    'app_private_key'       => $app_private_key,
    'app_cert_path'         => dirname(__FILE__).'/appPublicCert.crt',
    'alipay_cert_path'      => dirname(__FILE__).'/alipayPublicCert.crt',
    'alipay_root_cert_path' => dirname(__FILE__).'/alipayRootCert.crt',
];
$test = new testAliPayTransferService($config);
//$test->testUniTransfer();
//$test->testCommonQuery();
$alipay_user_id = '';
$test->testAccountQuery($alipay_user_id);
//$test->testBillDownloadUrlQuery();